
<h1>Edit &#8220;<?= $page_title ?>&#8221;</h1>
<? if(count($tabs)): ?>
	<form action="/admin/ajax_do_edit/" method="post" class="ajax">
		<div class="tabs">
			<ul>
				<? foreach($tabs as $name => $field_list): ?>
					<li><a href="#tab_<?= md5($name) ?>"><?= $name ?></a></li>
				<? endforeach; ?>
			</ul>
			<? foreach($tabs as $name => $field_list): ?>
				<div id="tab_<?= md5($name) ?>">
					<? foreach($field_list as $field): ?>
						<?
							$this->load->view(
								$fields[$field]->get_view(),
								array(
									'field' => $fields[$field]
								)
							);
						?>
					<? endforeach; ?>
					<div class="br"></div>
				</div>
			<? endforeach; ?>
		</div>
		<div class="buttons">
			<input type="hidden" name="object_class" value="<?= $object_class ?>" />
			<input type="hidden" name="object_id" value="<?= $object_id ?>" />
			<input type="hidden" name="object_version" value="<?= $object_version ?>" />
			<input type="submit" name="publish" value="Save &#38; Publish" />
			<input type="submit" name="save" value="Save" />
			<input type="submit" name="cancel" value="Cancel" />
			<div id="ajax_response"></div>
		</div>
	</form>
	<script type="text/javascript">
		$(document).ready(function() {
			// Set up tabs
			$(".tabs").tabs();
			
			$("form.ajax").ajaxForm({
				//target: "#ajax_response",
				beforeSubmit: edit_helper.cancel_submit,
				dataType:  'json',
				success: edit_helper.success
			});
		});
	</script>
<? endif; ?>
